home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Tools - Objects / C++ / MPW C++ 3.1b4 / Examples / CPlusExamples / ShapesApp.r < prev    next >
Text File  |  1990-03-21  |  8KB  |  303 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    MultiFinder-Aware Simple Shapes Sample Application
  4. #
  5. #    CPlusShapesApp
  6. #
  7. #    This file: ShapesApp.cp - Resource definitions for CPlusShapesApp
  8. #
  9. #    Copyright © 1988 Apple Computer, Inc.
  10. #    All rights reserved.
  11. #
  12. #    Versions:    1.0                 3/89
  13. #
  14. #    Components:
  15. #            CPlusShapesApp.make        March 1, 1989
  16. #            TApplicationCommon.h    March 1, 1989
  17. #            TApplication.h            March 1, 1989
  18. #            TDocument.h                March 1, 1989
  19. #            ShapesAppCommon.h        March 1, 1989
  20. #            ShapesApp.h                March 1, 1989
  21. #            ShapesDocument.h        March 1, 1989
  22. #            TApplication.cp            March 1, 1989
  23. #            TDocument.cp            March 1, 1989
  24. #            ShapesApp.cp            March 1, 1989
  25. #            ShapesDocument.cp        March 1, 1989
  26. #            TApplication.r            March 1, 1989
  27. #            ShapesApp.r                March 1, 1989
  28. #
  29. #   There are four main classes in this program. Each of
  30. #   these classes has a definition (.h) file and an
  31. #   implementation (.cp) file.  
  32. #   
  33. #   The TApplication class does all of the basic event
  34. #   handling and initialization necessary for Mac Toolbox
  35. #   applications. It maintains a list of TDocument objects,
  36. #   and passes events to the correct TDocument class when
  37. #   apropriate. 
  38. #   
  39. #   The TDocument class does all of the basic document
  40. #   handling work. TDocuments are objects that are
  41. #   associated with a window. Methods are provided to deal
  42. #   with update, activate, mouse-click, key down, and other
  43. #   events. Some additional classes which implement a
  44. #   linked list of TDocument objects are provided. 
  45. #   
  46. #   The TApplication and TDocument classes together define
  47. #   a basic framework for Mac applications, without having
  48. #   any specific knowledge about the type of data being
  49. #   displayed by the application's documents. They are a
  50. #   (very) crude implementation of the MacApp application
  51. #   model, without the sophisticated view heirarchies or
  52. #   any real error handling. 
  53. #   
  54. #   The TShapesApp class is a subclass of TApplication. It
  55. #   overrides several TApplication methods, including those
  56. #   for handling menu commands and cursor adjustment, and
  57. #   it does some necessary initialization.
  58. #   
  59. #   The TShapesDocument class is a subclass of TDocument. This
  60. #   class contains most of the special purpose code for
  61. #   shape drawing. In addition to overriding several of the
  62. #   TDocument methods, it defines a few additional
  63. #   methods which are used by the TShapesApp class to get
  64. #   information on the document state.  
  65. #
  66. #------------------------------------------------------------------------------*/
  67.  
  68. #include "SysTypes.r"
  69. #include "Types.r"
  70.  
  71. #include "ShapesAppCommon.h"
  72.  
  73. resource 'vers' (1) {
  74.     0x01, 0x00, release, 0x00,
  75.     verUS,
  76.     "1.00",
  77.     "1.00, Copyright © 1989 Apple Computer, Inc."
  78. };
  79.  
  80. /* we use an MBAR resource to conveniently load all the menus */
  81.  
  82. resource 'MBAR' (rMenuBar, preload) {
  83.     { mApple, mFile, mEdit, mShapes };        /* four menus */
  84. };
  85.  
  86.  
  87. resource 'MENU' (mApple, preload) {
  88.     mApple, textMenuProc,
  89.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  90.     enabled, apple,
  91.     {
  92.         "About CPlusShapesApp…",
  93.             noicon, nokey, nomark, plain;
  94.         "-",
  95.             noicon, nokey, nomark, plain
  96.     }
  97. };
  98.  
  99. resource 'MENU' (mFile, preload) {
  100.     mFile, textMenuProc,
  101.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  102.     enabled, "File",
  103.     {
  104.         "New",
  105.             noicon, "N", nomark, plain;
  106.         "Open",
  107.             noicon, "O", nomark, plain;
  108.         "-",
  109.             noicon, nokey, nomark, plain;
  110.         "Close",
  111.             noicon, "W", nomark, plain;
  112.         "Save",
  113.             noicon, "S", nomark, plain;
  114.         "Save As…",
  115.             noicon, nokey, nomark, plain;
  116.         "Revert",
  117.             noicon, nokey, nomark, plain;
  118.         "-",
  119.             noicon, nokey, nomark, plain;
  120.         "Page Setup…",
  121.             noicon, nokey, nomark, plain;
  122.         "Print…",
  123.             noicon, nokey, nomark, plain;
  124.         "-",
  125.             noicon, nokey, nomark, plain;
  126.         "Quit",
  127.             noicon, "Q", nomark, plain
  128.     }
  129. };
  130.  
  131. resource 'MENU' (mEdit, preload) {
  132.     mEdit, textMenuProc,
  133.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  134.     enabled, "Edit",
  135.      {
  136.         "Undo",
  137.             noicon, "Z", nomark, plain;
  138.         "-",
  139.             noicon, nokey, nomark, plain;
  140.         "Cut",
  141.             noicon, "X", nomark, plain;
  142.         "Copy",
  143.             noicon, "C", nomark, plain;
  144.         "Paste",
  145.             noicon, "V", nomark, plain;
  146.         "Clear",
  147.             noicon, nokey, nomark, plain
  148.     }
  149. };
  150.  
  151. resource 'MENU' (mShapes, preload) {
  152.     mShapes, textMenuProc,
  153.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  154.     enabled, "Shapes",
  155.     {    /* array: 5 elements */
  156.         /* [1] */
  157.         "Round Rect", noIcon, "R", noMark, plain,
  158.         /* [2] */
  159.         "Oval", noIcon, "O", noMark, plain,
  160.         /* [3] */
  161.         "Arc", noIcon, "A", noMark, plain,
  162.         /* [4] */
  163.         "-", noIcon, noKey, noMark, plain,
  164.         /* [5] */
  165.         "Move", noIcon, "M", noMark, plain
  166.     }
  167. };
  168.  
  169. /* this ALRT and DITL are used as an About screen */
  170.  
  171. resource 'ALRT' (rAboutAlert, purgeable) {
  172.     {40, 20, 160, 330 }, rAboutAlert, {
  173.         OK, visible, silent;
  174.         OK, visible, silent;
  175.         OK, visible, silent;
  176.         OK, visible, silent
  177.     };
  178. };
  179.  
  180. resource 'DITL' (rAboutAlert, purgeable) {
  181.     { /* array DITLarray: 5 elements */
  182.         /* [1] */
  183.         {88, 224, 108, 304},
  184.         Button {
  185.             enabled,
  186.             "OK"
  187.         },
  188.         /* [2] */
  189.         {8, 8, 24, 304 },
  190.         StaticText {
  191.             disabled,
  192.             "MultiFinder-Aware C++ Shapes Application"
  193.         },
  194.         /* [3] */
  195.         {32, 8, 48, 237},
  196.         StaticText {
  197.             disabled,
  198.             "Copyright © 1989 Apple Computer"
  199.         },
  200.         /* [4] */
  201.         {56, 8, 72, 136},
  202.         StaticText {
  203.             disabled,
  204.             "Brought to you by:"
  205.         },
  206.         /* [5] */
  207.         {80, 24, 112, 167},
  208.         StaticText {
  209.             disabled,
  210.             "Macintosh Developer  Technical Support"
  211.         }
  212.     }
  213. };
  214.  
  215.  
  216. resource 'WIND' (rDocWindow, preload, purgeable) {
  217.     {64, 60, 314, 460},
  218.     noGrowDocProc, invisible, goAway, 0x0, "Shape Land"
  219. };
  220.  
  221.  
  222. resource 'STR#' (kShapesAppErrStrings, purgeable) {
  223.     {
  224.     "Not enough memory to run ShapesApp";
  225.     "Cannot create window";
  226.     }
  227. };
  228.  
  229. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  230.  
  231. resource 'SIZE' (-1) {
  232.     dontSaveScreen,
  233.     acceptSuspendResumeEvents,
  234.     enableOptionSwitch,
  235.     canBackground,        /* we can background; we don't currently, but our sleep value */
  236.                         /* guarantees we don't hog the Mac while we are in the background */
  237.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  238.     backgroundAndForeground, /* this is definitely note a background-only application! */
  239.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  240.     ignoreChildDiedEvents,
  241.     is32BitCompatible,
  242.     reserved, reserved, reserved, reserved,
  243.     reserved, reserved, reserved,
  244.     kPrefSize * 1024,
  245.     kMinSize * 1024
  246. };
  247.  
  248.  
  249. type 'MOOT' as 'STR ';
  250.  
  251.  
  252. resource 'MOOT' (0) {
  253.     "MultiFinder-Aware C++ Shape Drawing Application"
  254. };
  255.  
  256.  
  257. resource 'BNDL' (128) {
  258.     'MOOT',
  259.     0,
  260.     {
  261.         'ICN#',
  262.         {
  263.             0, 128
  264.         },
  265.         'FREF',
  266.         {
  267.             0, 128
  268.         }
  269.     }
  270. };
  271.  
  272.  
  273. resource 'FREF' (128) {
  274.     'APPL',
  275.     0,
  276.     ""
  277. };
  278.  
  279.  
  280. resource 'ICN#' (128) {
  281.     { /* array: 2 elements */
  282.         /* [1] */
  283.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  284.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  285.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  286.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  287.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  288.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  289.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  290.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  291.         /* [2] */
  292.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  293.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  294.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  295.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  296.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  297.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  298.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  299.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  300.     }
  301. };
  302.  
  303.